import Vue from 'vue'
import VueRouter from 'vue-router'

Vue.use(VueRouter)

const routes = [
  {
    path: "/",
    redirect: "/sfzy"
  },
  {
    path: "/login",
    name: "Login",
    component: () => import('@/views/Login.vue')
  },
  {
    path: "/index",
    name: "Index",
    component: () => import('@/views/HomeView.vue')
  },
  {
    path: "/article",
    name: "Article",
    component: () => import('@/components/ArticleComponent.vue')
  },
  {
    path:"/article/choiceArticle",
    name:"ChoiceArticle",
    component:()=> import('@/components/ChoiceArticle.vue')
  },
  {
    path:"/admin/user",
    name:"User",
    component:()=> import('@/components/UserComponent.vue')
  },
  {
    path: "/sfzy",
    name: "Sfzy",
    component: () => import('@/components/SfzyComponent.vue')
  },
  {
    path: "/admin/componey",
    name: "Componey",
    component: () => import('@/components/ComponeyComponet.vue')
  },
  {
    path: "/course/course",
    name: "Componey",
    component: () => import('@/components/CourseComponet.vue')
  },

//    心理知识
  {
    path: "/psychologyKnowledge/psychologyKnowledge",
    name: "/PsychologyKnowledge",
    component:()=> import('@/components/PsychologyKnowledgeComponent.vue')
  },
//    搜索--心理专家
  {
    path: "/psychologyKnowledge/SearchHeartExpect",
    name: "SearchHeartExpect",
    component:()=> import("@/components/SearchHeartExpect.vue")
  },

//  搜索--心理文章
  {
    path: "/psychologyKnowledge/SearchHeartEssay",
    name: "/SearchHeartEssay",
    component:()=> import("@/components/SearchHeartEssay.vue")
  },
//  搜索--提问回答
  {
    path:"/psychologyKnowledge/QuestionsReply",
    name: "/QuestionsReply",
    component:()=> import("@/components/QuestionsReply.vue")
  },
//    搜索--心理测试
  {
    path: "/psychologyKnowledge/SearchHeartTest",
    name: "/SearchHeartTest",
    component:()=> import("@/components/SearchHeartTest.vue")
  },


  {
    path:"/psychometricTesting/psychometricTesting",
    name:"Componey",
    component:()=> import('@/components/PsychometricTesting.vue')
  },
  {
    path:"/test/test",
    name:"Componey",
    component:()=> import('@/components/Test.vue')
  },
  {
    path: "/sspsychologicalTopic/topic",
    name: "sspsychologicalTopic",
    component: () => import('@/components/SSPsychologicalTopicComponent.vue')

  },

  {
    path:"/usermark/usermark",
    name:"Usermark",
    component:()=> import('@/components/Usermark.vue')
  },

  {
    path:"/charge/charge",
    name:"Charge",
    component:()=> import('@/components/Charge.vue')
  },
  {
    path:"/consultProblem/consultProblem",
    name:"ConsultProblem",
    component:()=> import('@/components/ConsultProblem.vue')
  },

  {
    path:"/consultreply/consultreply",
    name:"ConsultReply",
    component:()=> import('@/components/ConsultReply.vue')
  },

  {
    path:"/teacherlevel/teacherlevel",
    name:"Teacherlevel",
    component:()=> import('@/components/Teacherlevel.vue')
  },

  {
    path:"/articletype/articletype",
    name:"Articletype",
    component:()=> import('@/components/Articletype.vue')
  },

  {
    path:"/book/book",
    name:"Book",
    component:()=> import('@/components/Book.vue')
  },








  {
    path: "/sspsychologicalTopic/reply",
    name: "sspsychologicalTopicReply",
    component: () => import('@/components/SSPsychologicalTopicReplyComponent.vue')

  },
  {

    path: "/consult/consult",
    name: "Componey",
    component: () => import('@/components/ConsultAppointment.vue')
  },
  {
    path:"/admin/consultants",
    name:"consultants",
    component: () => import("@/components/Consultants.vue")
  },
  {
    path:"/free",
    name:"free",
    component: () => import("@/components/FreeComponent.vue")
  }

]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

//路由守卫
// router.beforeEach((to,from,next)=>{
//   if(to.name == 'login'){
//     next()
//     return;
//   }
//   const uid = sessionStorage.getItem("uid")
//   if(uid==null||uid==undefined){
//     next('Login')
//     return;
//   }
//   next()
// })

export default router
